import { IFeidaoAiBrowserComponent } from '@feidao/web/interfaces';
import set from '@feidao/web/atom/browser/global/set';

export default async function (fd: IFeidaoAiBrowserComponent, ...args: any[]) {
	console.log('all_check');
	const one_checks = Array.from(fd.data.node.querySelectorAll('[data-feidao-id="one_check"]'));
	const all_check = fd.data.node.querySelector("#all_check") as HTMLInputElement;
	const del_data: any = one_checks.map((one: HTMLInputElement) => {
		one.checked = all_check.checked;
		return { _id: one.dataset.feidaoDel };
	});
	if (all_check.checked) {
		set("del_data", del_data);
	} else {
		set("del_data", []);
	}
}
